package com.lsc.study.oop;

/**
 * 这是一个 学生类
 * 类（模板） = 属性 + 方法
 */
public class Student {

    /* 类中的属性的变量的数据类型  用包装类  */
    private Integer stuNo;

    /* 性别 */
    private String stuSex;

    /* name */
    private String stuName;

    /* 年龄 */
    private Integer stuAge;

    public Student() {
    }

    public Student(Integer stuNo, String stuSex, String stuName, Integer stuAge) {
        this.stuNo = stuNo;
        this.stuSex = stuSex;
        this.stuName = stuName;
        if (stuAge <= 0 || stuAge > 120) {
            this.stuAge = 20;
        } else {
            this.stuAge = stuAge;
        }
    }

    public Integer getStuNo() {
        return stuNo;
    }

    public void setStuNo(Integer stuNo) {
        this.stuNo = stuNo;
    }

    public String getStuSex() {
        return stuSex;
    }

    public void setStuSex(String stuSex) {
        this.stuSex = stuSex;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public Integer getStuAge() {
        return stuAge;
    }

    public void setStuAge(Integer stuAge) {
        if (stuAge <= 0 || stuAge > 120) {
            this.stuAge = 20;
        } else {
            this.stuAge = stuAge;
        }
    }

    /* 在类中 有 toString 方法  */
    /* alt + insert */
    @Override
    public String toString() {
        return "Student{" +
                "stuNo=" + stuNo +
                ", stuSex='" + stuSex + '\'' +
                ", stuName='" + stuName + '\'' +
                ", stuAge=" + stuAge +
                '}';
    }
}
